<?php
/**
 * SocialEngine
 *
 * @category   Application_Extensions
 * @package    Vote
 * @copyright  Copyright KEENONWEB LLC
 * @license    http://www.keenonweb.com/
 * @version    $Id: Search.php 2011-03-09 08:45:41Z idris $
 * @author     Idris
 */

/**
 * @category   Application_Extensions
 * @package    Vote
 * @copyright  Copyright KEENONWEB LLC
 * @license    http://www.keenonweb.com/
 */

class Vote_Form_Photo_Search extends Engine_Form {
	protected $_fieldType = 'vote_challenge';
	
	public function init() {
		
		$this->addDecorators ( array ('FormElements', array (array ('li' => 'HtmlTag' ), array ('tag' => 'ul' ) ), array ('HtmlTag', array ('tag' => 'div', 'class' => 'field_search_criteria' ) ), 'Form' ) );
		
		$this->setAttrib ( 'class', 'field_search_criteria' );
		
		$this->setAttribs ( array ('id' => 'filter_form', 'class' => 'votesbrowse_filters field_search_criteria' ) )->setAction ( $_SERVER ['REQUEST_URI'] )->getDecorator ( 'HtmlTag' )->setOption ( 'class', 'browsevotes_criteria votes_browse_filters' );
		
		$this->getAdditionalOptionsElement ();
	}
	
	public function getAdditionalOptionsElement() {
		$i = 5000;
		
		$this->addElement ( 'Hidden', 'page', array ('order' => $i -- ) );
		
		$this->addElement ( 'Hidden', 'tag', array ('order' => $i -- ) );
		
		$this->addElement ( 'Text', 'keyword', array ('label' => 'Keyword', 'order' => $i --, 'decorators' => array ('ViewHelper', array ('Label', array ('tag' => 'span' ) ), array ('HtmlTag', array ('tag' => 'li' ) ) ) ) );
		
		$this->addElement ( 'Select', 'sort', array ('label' => 'Browse By', 'multiOptions' => array ('alphabet' => 'Alphabetically', 'view_count' => 'Most Viewed', 'creation_date' => 'Most Recent' ), 'onchange' => 'searchChallenges();', 'order' => $i --, 'decorators' => array ('ViewHelper', array ('Label', array ('tag' => 'span' ) ), array ('HtmlTag', array ('tag' => 'li' ) ) ) ) );
		
		$this->addElement ( 'Select', 'show', array ('label' => 'Show', 'multiOptions' => array ('1' => 'Everyone\'s Votings', '2' => 'Only My Friends\' Votings' ), 'onchange' => 'searchChallenges();', 'order' => $i --, 'decorators' => array ('ViewHelper', array ('Label', array ('tag' => 'span' ) ), array ('HtmlTag', array ('tag' => 'li' ) ) ) ) );
		
		$this->addElement ( 'Select', 'period', array ('label' => 'Display', 'multiOptions' => array ('' => 'All Votings', 'active' => 'Only Active Votings', 'upcoming' => 'Only Upcoming Votings', 'past' => 'Only Past Votings' ), 'onchange' => 'searchChallenges();', 'order' => $i --, 'decorators' => array ('ViewHelper', array ('Label', array ('tag' => 'span' ) ), array ('HtmlTag', array ('tag' => 'li' ) ) ) ) );
		
		$options = Engine_Api::_ ()->vote ()->getCategoryOptions ( 'photo' );
		$options [0] = 'All Categories';
		$this->addElement ( 'Select', 'category', array ('label' => 'Category', 'multiOptions' => $options, 'onchange' => 'searchChallenges();', 'order' => $i --, 'decorators' => array ('ViewHelper', array ('Label', array ('tag' => 'span' ) ), array ('HtmlTag', array ('tag' => 'li' ) ) ) ) );
		
		$this->addElement ( 'Checkbox', 'has_photo', array ('label' => 'Only Votings With Photos', 'order' => 10000000, 'decorators' => array ('ViewHelper', array ('Label', array ('placement' => 'APPEND', 'tag' => 'label' ) ), array ('HtmlTag', array ('tag' => 'li' ) ) ) ) );
		
		$this->addElement ( 'Button', 'search', array ('label' => 'Search', 'onclick' => 'searchChallenges();', 'ignore' => true, 'order' => 10000001, 'decorators' => array ('ViewHelper', //array('Label', array('tag' => 'span')),
		array ('HtmlTag', array ('tag' => 'li' ) ) ) ) );
	
	}

}